package com.spotmanger.project.modular.spottable.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.spotmanger.project.modular.spottable.entity.SpottableJsxmEntity;
import com.spotmanger.project.modular.spottable.mapper.SpottableJsxmNewMapper;
import com.spotmanger.project.modular.spottable.service.SpottableJsxmNewService;
import org.springframework.stereotype.Service;


@Service("spottableJsxmNewService")
public class SpottableJsxmNewServiceImpl extends ServiceImpl<SpottableJsxmNewMapper, SpottableJsxmEntity> implements SpottableJsxmNewService {
    /**
     * 以TBBH为主,结合 LambdaQueryWrapper的模糊搜索方法。
     */
    @Override
    public LambdaQueryWrapper<SpottableJsxmEntity> searchByTBBH(SpottableJsxmEntity spottableJsxm) {
        LambdaQueryWrapper<SpottableJsxmEntity> queryWrapper = Wrappers.lambdaQuery();
        if (spottableJsxm.getTBBH() != null) {
            queryWrapper.like(SpottableJsxmEntity::getTBBH, spottableJsxm.getTBBH());
        } else if (spottableJsxm.getXZS() != null) {
            queryWrapper.like(SpottableJsxmEntity::getXZS, spottableJsxm.getXZS());
        } else if (spottableJsxm.getXZX() != null) {
            queryWrapper.like(SpottableJsxmEntity::getXZX, spottableJsxm.getXZX());
        } else if (spottableJsxm.getHCDW() != null) {
            queryWrapper.like(SpottableJsxmEntity::getHCDW, spottableJsxm.getHCDW());
        } else if (spottableJsxm.getHCRY() != null) {
            queryWrapper.like(SpottableJsxmEntity::getHCRY, spottableJsxm.getHCRY());
        } else if (spottableJsxm.getYSDW() != null) {
            queryWrapper.like(SpottableJsxmEntity::getYSDW, spottableJsxm.getYSDW());
        } else if (spottableJsxm.getSHLX() != null) {
            queryWrapper.like(SpottableJsxmEntity::getSHLX, spottableJsxm.getSHLX());
        } else if (spottableJsxm.getFKFX() != null) {
            queryWrapper.like(SpottableJsxmEntity::getFKFX, spottableJsxm.getFKFX());
        } else if (spottableJsxm.getSSZT() != null) {
            queryWrapper.like(SpottableJsxmEntity::getSSZT, spottableJsxm.getSSZT());
        } else if (spottableJsxm.getYSJL() != null) {
            queryWrapper.like(SpottableJsxmEntity::getYSJL, spottableJsxm.getYSJL());
        } else {
            return queryWrapper;
        }
        return queryWrapper;
    }

}